﻿
@page
@model AdminUI.Pages.Mall.GoodsEditModel
@{
    var F = Html.F();
}

@section body{
    <f:Form ID="Form1" ShowBorder="false" ShowHeader="false" AutoScroll="true" BodyPadding="15" IsViewPort="true">
        <Rows>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:HiddenField ID="GoodsID" Text="@Model.Current.GoodsID"></f:HiddenField>
                    <f:TextBox ID="GoodsName" Required="true" Label="商品名称" EmptyText="请输入商品名称" Text="@Model.Current.GoodsName" ShowRedStar="true"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:FileUpload ID="ImageUrl" Label="商品主图" Text="@Model.Current.ImageUrl" AcceptFileTypes="image/*" ButtonIcon="Add"></f:FileUpload>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:DropDownList ID="CategoryID" Label="选择类别" DataValueField="CategoryID" DataTextField="CategoryName" SelectedValue="@Model.Current.CategoryID" DataSource="@ViewBag.Categories"></f:DropDownList>
                    <f:RadioButtonList ID="Status" Label="状态" SelectedValue="@Model.Current.Status">
                        @* <f:RadioItem Text="待售" Value="0" /> *@
                        <f:RadioItem Text="在售" Value="1" />
                        <f:RadioItem Text="下架" Value="2" />
                    </f:RadioButtonList>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:NumberBox ID="CostPrice" Label="成本价" EmptyText="" Text="@Model.Current.CostPrice" MaxValue="999999" MinValue="0" NoDecimal="false" ShowTrigger="false"></f:NumberBox>
                    <f:NumberBox ID="MarketPrice" Label="市场价" EmptyText="" Text="@Model.Current.MarketPrice" MaxValue="999999" MinValue="0" NoDecimal="false" ShowTrigger="false"></f:NumberBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="75% 25%">
                <Items>
                    <f:RadioButtonList ID="IsSpecial" Label="特价设置"  OnSelectedIndexChanged="@Url.Handler("RBL_SelectedIndexChanged")" OnSelectedIndexChangedParameter1="@(new Parameter("selected", "this.getValue()"))">
                        <f:RadioItem Text="不设置" Value="false" Selected="@Model.Current.IsSpecial == false" />
                        <f:RadioItem Text="设置各级别价格和业绩提成" Value="true" Selected="@Model.Current.IsSpecial" />
                    </f:RadioButtonList>
                    <f:NumberBox ID="SortFlag" Label="排序" EmptyText="" Text="@Model.Current.SortFlag" MinValue="0" ShowTrigger="true"></f:NumberBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:NumberBox ID="MAPrice" Label="A级会员价" MaxValue="999999" Text="@Model.Current.MAPrice" MinValue="0" NoDecimal="false" ShowTrigger="false" Enabled="@Model.Current.IsSpecial"></f:NumberBox>
                    <f:NumberBox ID="MBPrice" Label="B级会员价" MaxValue="999999" Text="@Model.Current.MBPrice" MinValue="0" NoDecimal="false" ShowTrigger="false" Enabled="@Model.Current.IsSpecial"></f:NumberBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:NumberBox ID="MCPrice" Label="C级会员价" MaxValue="999999" Text="@Model.Current.MCPrice" MinValue="0" NoDecimal="false" ShowTrigger="false" Enabled="@Model.Current.IsSpecial"></f:NumberBox>
                    <f:NumberBox ID="Commission" Label="业绩提成" MaxValue="999999" Text="@Model.Current.Commission" MinValue="0" NoDecimal="false" ShowTrigger="false" Enabled="@Model.Current.IsSpecial"></f:NumberBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:CheckBoxList ID="SalesRange" Label="销售范围">
                        <f:CheckItem Text="A级会员" Value="1" Selected="@(Model.Current.SalesRange & 1) > 0" />
                        <f:CheckItem Text="B级会员" Value="2" Selected="@(Model.Current.SalesRange & 2) > 0" />
                        <f:CheckItem Text="C级会员" Value="4" Selected="@(Model.Current.SalesRange & 4) > 0" />
                    </f:CheckBoxList>
                </Items>
            </f:FormRow>
        </Rows>
        <Toolbars>
            <f:Toolbar ID="Toolbar1" Position="Top" ToolbarAlign="Left">
                <Items>
                    <f:Button ID="btnClose" Text="关闭" Icon="Cross" IconFont="Close" OnClientClick="F.activeWindow.hide();"></f:Button>
                    <f:Button ID="btnReset" Text="重置" Icon="ArrowUndo" OnClientClick="F.ui.Form1.reset();"></f:Button>
                    <f:Button ID="btnSubmit" Text="保存" Icon="SystemSave" OnClick="@Url.Handler("btnSubmit_Click")" _ValidateForms="Form1" OnClickFields="Form1"></f:Button>

                </Items>
            </f:Toolbar>
        </Toolbars>
    </f:Form>

    <f:Window ID="Window1" IsModal="true" Hidden="true" Target="Top" EnableResize="true" EnableMaximize="true" EnableIFrame="true" Width="400" Height="500">
        <Listeners>
            <f:Listener Event="close" Handler="onWindowClose('refresh');"></f:Listener>
        </Listeners>
    </f:Window>

}
@section head{
    <link href="https://cdn.bootcdn.net/ajax/libs/wangeditor5/5.1.23/css/style.min.css" rel="stylesheet">
    <style>
        #editor—wrapper {
            border: 1px solid #ccc;
            z-index: 100; /* 按需定义 */
        }

        #toolbar-container {
            border-bottom: 1px solid #ccc;
        }

        #editor-container {
            height: 500px;
        }
    </style>
}
@section script {
    <script src="https://cdn.bootcdn.net/ajax/libs/wangeditor5/5.1.23/index.min.js"></script>
    <script>



    </script>
}
